﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLL;
using Model;
using System.Data;
using System.Data.SqlClient;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace NCRE学生考试端V1._0
{

   public class WordACreateTable
    {
        //修改人：李金颖-修改判题路径-2018-12-21 08:30:14
        private static Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
        private static object unknow = Type.Missing;
        //private static object file = @"D:\" + MyInfo.MystudentID() + @"\计算机一级考生文件\" + MyInfo.MyPaperType().Trim() + "卷\\Wordkt\\Word" + MyInfo.MyPaperType().Trim() + ".docx";
        private static object file = @"D:\" + MyInfo.MystudentID() + @"\计算机一级考生文件\" + MyInfo.MyPaperType().Trim() + "卷\\Wordkt\\bg" + MyInfo.MyPaperType().Trim() + ".docx";
        private readonly Microsoft.Office.Interop.Word.Document doc = app.Documents.Add(ref file, ref unknow, ref unknow, ref unknow);
        private readonly WordQuestionEntityBll wordquestionbll = new WordQuestionEntityBll();
        private readonly WordQuestionEntity wordinfo = new WordQuestionEntity();
        readonly WordLoadinfo gonggong = new WordLoadinfo();
        #region 王荣晓  表格行高
        /// <summary>
        /// 表格行高
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetLineHeight(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {

            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag = '表格行高'");
            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }

                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);
            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Height.ToString() + doc.Tables[Para_FormID].Cell(Para_QuadrantX + 1, Para_QuadrantY).Height.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));



            }

        }
        #endregion

        #region 王荣晓  表格列宽  修改人：李少然 2015年12月21日
        /// <summary>
        ///  表格列宽
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetColWeight(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag like '%表格列宽%'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {

                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Width.ToString() + doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY + 1).Width.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }


                if (drs_word.Count() == 0)
                {
                    return;
                }
                //将试题的ID选择出来
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }
        }
        #endregion

        #region 王荣晓  合并单元格文字
        /// <summary>
        /// 合并单元格文字   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetFirstColFont(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_StringStartIndex, Int32 Para_StringLength)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag like '%合并单元格文字%'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;

                //将考生答案传递给studentrecord实体
                if (doc.Tables[Para_FormID].Range.Text.Trim() == "" || doc.Tables[Para_FormID].Range.Text.Trim() == "\r")
                {
                    studentrecord.ExamAnswer = "空答案";
                }
                else
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Range.Text.Trim().Substring(Para_StringStartIndex, Para_StringLength);
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }

                }
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }
        }
        #endregion

        #region 王荣晓  表格底纹
        /// <summary>
        ///  表格底纹
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetColShading(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag like '%表格底纹%'");

            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "0";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;

                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.BackgroundPatternColorIndex.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region  王荣晓 表格文字  修改人:于云秀 2018年4月22日20:15:06
        /// <summary>
        /// 表格文字
        /// </summary>
        /// <param name="studentinfo"></param>
        //public void FindFormTextD(WordQuestionEntity wordinfo, System.Data.DataTable dt)
        //{
        //    WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

        //    DataRow[] drs_word = dt.Select("QuestionFlag like '%表格文字%'");

        //    if (doc.Tables.Count == 0)
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //如果表格不存在，则判分为0
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        studentrecord.ExamAnswer = "空答案";
        //        studentrecord.Fration = "0";
        //        //将答题记录送到数据库
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

        //        WordLoadinfo.list.Add(studentrecord);

        //    }
        //    else
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //传递考生ID进studentrecord实体
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        if (doc.Tables[1].Rows.Count >= 1 && doc.Tables[1].Columns.Count >= 1)
        //        {
        //            try
        //            {
        //                //将考生答案传递给studentrecord实体
        //                studentrecord.ExamAnswer = doc.Tables[1].Cell(1, 1).Range.Text.Substring(0, 2);
        //            }
        //            catch (Exception)
        //            {
        //                studentrecord.ExamAnswer = "空答案";
        //            }
        //        }
        //        else
        //        {
        //            studentrecord.ExamAnswer = "空答案";
        //        }

        //        //将试题的ID选择出来
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
        //        //判分
        //        WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


        //    }
        //}

        #endregion

        #region 王荣晓  表格文字格式
        /// <summary>
        ///  表格文字格式
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableWordFormat(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '表格文字格式'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).VerticalAlignment.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来  修改：注释掉return，刁琳童--2018年12月25日
                //if (drs_word.Any() == true)
                //{
                //    return;
                //}
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region  王荣晓 表格文字型号  修改人:于云秀 2018年4月22日20:20:20 
        ///// <summary>
        ///// 表格文字型号
        ///// </summary>
        ///// <param name="studentinfo"></param>
        //public void FindCharFormatD(WordQuestionEntity wordinfo, System.Data.DataTable dt)
        //{
        //    WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

        //    DataRow[] drs_word = dt.Select("QuestionFlag = '表格文字型号'");

        //    if (doc.Tables.Count == 0)
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //如果表格不存在，则判分为0
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        studentrecord.ExamAnswer = "0";
        //        studentrecord.Fration = "0";
        //        //将答题记录送到数据库
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

        //        WordLoadinfo.list.Add(studentrecord);

        //    }
        //    else
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //传递考生ID进studentrecord实体
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        if (doc.Tables[1].Rows.Count >= 1 && doc.Tables[1].Columns.Count >= 1)
        //        {
        //            try
        //            {
        //                //将考生答案传递给studentrecord实体
        //                studentrecord.ExamAnswer = doc.Tables[1].Cell(1, 1).Range.Font.Name.ToString();
        //            }
        //            catch (Exception)
        //            {
        //                studentrecord.ExamAnswer = "空答案";
        //            }
        //        }
        //        else
        //        {
        //            studentrecord.ExamAnswer = "空答案";
        //        }

        //        //将试题的ID选择出来
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
        //        //判分
        //        WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


        //    }



        //}

        #endregion

        #region  王荣晓 表格文字大小 修改人:于云秀 2018年4月22日20:21:32
        /// <summary>
        /// 表格文字大小
        /// </summary>
        /// <param name="studentinfo"></param>
        //public void FindCharFontSizeD(WordQuestionEntity wordinfo, System.Data.DataTable dt)
        //{
        //    WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

        //    DataRow[] drs_word = dt.Select("QuestionFlag = '表格文字大小'");

        //    if (doc.Tables.Count == 0)
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //如果表格不存在，则判分为0
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        studentrecord.ExamAnswer = "空答案";
        //        studentrecord.Fration = "0";
        //        //将答题记录送到数据库
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

        //        WordLoadinfo.list.Add(studentrecord);

        //    }
        //    else
        //    {
        //        studentrecord.TimeStamp = MyInfo.TimeTamp();
        //        //传递考生ID进studentrecord实体
        //        studentrecord.StudentID = FrmLogin.studentID;
        //        if (doc.Tables[1].Rows.Count >= 1 && doc.Tables[1].Columns.Count >= 1)
        //        {
        //            try
        //            {
        //                //将考生答案传递给studentrecord实体
        //                studentrecord.ExamAnswer = doc.Tables[1].Cell(1, 1).Range.Font.Size.ToString();
        //            }
        //            catch (Exception)
        //            {
        //                studentrecord.ExamAnswer = "空答案";
        //            }

        //        }
        //        else
        //        {
        //            studentrecord.ExamAnswer = "空答案";
        //        }

        //        //将试题的ID选择出来
        //        if (drs_word.Count() == 0)
        //        {
        //            return;
        //        }
        //        studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
        //        //判分
        //        WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


        //    }

        //}

        #endregion

        #region 王荣晓  表格格式
        /// <summary>
        ///  表格格式
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableWordFormatA(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag = '表格格式'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (drs_word.Count() == 0)
                {
                    return;
                }
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Rows.Alignment.ToString();
                //将试题的ID选择出来
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region 王荣晓  单行表格字体型号
        /// <summary>
        /// 单行表格字体型号   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetOneRowFontName(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '单行表格字体型号'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Font.Name.ToString();
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }

                }
                else
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region 王荣晓  单行表格字体大小
        /// <summary>
        /// 单行表格字体大小   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetOneRowFontSize(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '单行表格字体大小'");

            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }

                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Font.Size.ToString();
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }



                }
                else
                {
                    studentrecord.ExamAnswer = "0";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region  李少然 单行表格填充颜色   修改人:于云秀 2018年4月22日20:41:12
        /// <summary>
        /// 表格内边框线颜色
        /// </summary>
        /// <param name="studentinfo"></param>
        public void TableSingelInColorE(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格单行填充颜色'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                try
                {

                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.BackgroundPatternColorIndex.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }




        }

        #endregion

        #region 李少然 单行表格字体颜色  修改人:于云秀 2018年4月22日20:44:50
        /// <summary>
        /// 表格单行字体颜色
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableSingleSizeColorG(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格单行字体颜色'");

            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.ForegroundPatternColor.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }


                if (drs_word.Count() == 0)
                {
                    return;
                }
                //将试题的ID选择出来
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region 李少然 单行表格底纹 修改人:于云秀 2018年4月22日20:52:57
        /// <summary>
        /// 表格单行底纹
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableSingleShadingH(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag='表格单行底纹'");
            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "0";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);
            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.BackgroundPatternColorIndex.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }

        }
        #endregion

        #region 王荣晓 表格文字型号
        /// <summary>
        /// 表格字体型号     
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetFontName(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '表格文字型号'");

            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Font.Name.ToString();
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }


                }
                else
                {
                    studentrecord.ExamAnswer = "0";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }
        }
        #endregion

        #region  王荣晓  表格文字大小
        /// <summary>
        /// 表格字体大小     
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetFontSize(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag ='表格文字大小'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Font.Size.ToString();
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }

                }
                else
                {
                    studentrecord.ExamAnswer = "0";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region 李少然 表格字体颜色  修改人:于云秀 2018年4月22日20:46:44
        /// <summary>
        /// 表格字体颜色
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableLineSizeColorG(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格字体颜色'");

            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.ForegroundPatternColor.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }


                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }

        }
        #endregion

        #region 李少然 表格文字 修改人:于云秀 2018年4月22日20:46:44
        /// <summary>
        /// 表格文字
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableWordFormatH(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_StringStartIndex, Int32 Para_StringLength)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag='表格文字'");
            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);
            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (doc.Tables[Para_FormID].Range.Text.Trim().ToString() == "" || doc.Tables[1].Range.Text == "\r")
                {
                    studentrecord.ExamAnswer = "空答案";
                }
                else
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Range.Text.Trim().Substring(Para_StringStartIndex, Para_StringLength);
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }
                }
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }


        }
        #endregion

        #region  王荣晓  表格文字加粗
        /// <summary>
        /// 表格字体加粗     
        /// </summary>
        /// <param name="wordinfo"></param>
        public void SetFontBold(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '表格文字加粗'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Font.BoldBi.ToString();
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }

                }
                else
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion

        #region 王荣晓  表格外边框线
        /// <summary>
        /// 表格外边框线   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void FormBorderFont(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '表格外边框线'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.OutsideLineWidth.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }
        }
        #endregion

        #region 王荣晓  表格内边框线
        /// <summary>
        /// 表格内边框线   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void FormInBorderFont(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag = '表格内边框线'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "0";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.InsideLineWidth.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion 

        #region 王荣晓  表格边框线颜色
        /// <summary>
        /// 表格边框线颜色   
        /// </summary>
        /// <param name="wordinfo"></param>
        public void FormInBorderColorFont(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag like '%表格边框线颜色%'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "0";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.InsideColorIndex.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }
        #endregion 

        #region  李少然 表格外边框线颜色   修改人:于云秀  2018年4月22日20:39:04
        /// <summary>
        /// 表格外边框线颜色
        /// </summary>
        /// <param name="studentinfo"></param>
        public void TableBoldBolderOutColorE(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格外边框线颜色'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.OutsideColorIndex.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }

        }

        #endregion、

        #region  李少然 表格内边框线颜色  修改人:于云秀  2018年4月22日20:40:22
        /// <summary>
        /// 表格内边框线颜色
        /// </summary>
        /// <param name="studentinfo"></param>
        public void TableBoldBolderInColorE(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格内边框线颜色'");

            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                //传递时间戳进studentrecord实体
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.InsideColorIndex.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }

        #endregion

        #region  王荣晓 查找表格内容  修改人:于云秀  2018年4月22日20:40:22
        /// <summary>
        /// 查找表格内容
        /// </summary>
        /// <param name="studentinfo"></param>
        public void FindFormTextC(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {

            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='查找表格内容'");
            studentrecord.TimeStamp = MyInfo.TimeTamp();
            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                if (doc.Tables[Para_FormID].Rows.Count >= Para_QuadrantX && doc.Tables[Para_FormID].Columns.Count >= Para_QuadrantY)
                {
                    try
                    {
                        //将考生答案传递给studentrecord实体
                        studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Range.Text.Substring(Para_QuadrantX - 5, Para_QuadrantY);
                    }
                    catch (Exception)
                    {
                        studentrecord.ExamAnswer = "空答案";
                    }

                }
                else
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }

        #endregion

        #region  李少然 表格外边框 修改人:于云秀  2018年4月22日20:40:22
        /// <summary>
        /// 表格外边框
        /// </summary>
        /// <param name="studentinfo"></param>
        public void TableBoldBolderF(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID)
        {

            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();

            DataRow[] drs_word = dt.Select("QuestionFlag='表格外边框'");
            studentrecord.TimeStamp = MyInfo.TimeTamp();
            if (doc.Tables.Count == 0)
            {
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "空答案";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);

            }
            else
            {
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;

                //将考生答案传递给studentrecord实体
                studentrecord.ExamAnswer = doc.Tables[Para_FormID].Borders.OutsideLineWidth.ToString();
                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));


            }
        }

        #endregion

        #region 李少然 表格单行字体颜色 修改人：于云秀  2018年4月24日11:48:31
        /// <summary>
        /// 表格单行字体颜色
        /// </summary>
        /// <param name="wordinfo"></param>
        public void TableLineSizeColorH(WordQuestionEntity wordinfo, DataTable dt, Int32 Para_FormID, Int32 Para_QuadrantX, Int32 Para_QuadrantY)
        {
            WordQuestionRecordEntity studentrecord = new WordQuestionRecordEntity();
            DataRow[] drs_word = dt.Select("QuestionFlag='表格单行文字颜色'");
            if (doc.Tables.Count == 0)
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //如果表格不存在，则判分为0
                studentrecord.StudentID = FrmLogin.studentID;
                studentrecord.ExamAnswer = "0";
                studentrecord.Fration = "0";
                //将答题记录送到数据库
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);

                WordLoadinfo.list.Add(studentrecord);
            }
            else
            {
                studentrecord.TimeStamp = MyInfo.TimeTamp();
                //传递考生ID进studentrecord实体
                studentrecord.StudentID = FrmLogin.studentID;
                try
                {
                    //将考生答案传递给studentrecord实体
                    studentrecord.ExamAnswer = doc.Tables[Para_FormID].Cell(Para_QuadrantX, Para_QuadrantY).Shading.ForegroundPatternColor.ToString();
                }
                catch (Exception)
                {
                    studentrecord.ExamAnswer = "空答案";
                }

                //将试题的ID选择出来
                if (drs_word.Count() == 0)
                {
                    return;
                }
                studentrecord.QuestionID = Convert.ToDouble(drs_word[0]["QuestionID"]);
                //判分
                WordLoadinfo.list.Add(gonggong.getStudentRecord(drs_word, studentrecord));
            }


        }
        #endregion
    }
}

